// ShaderManager.java
package com.goldsprite.gameframeworks.shaders;

import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.utils.Disposable;

public class ShaderManager implements Disposable {
    private VegetationShader vegetationShader;
    private WaterShader waterShader;
    private ShaderType currentShader = ShaderType.NONE;

    public enum ShaderType {
        NONE, VEGETATION, WATER
    }

    public ShaderManager() {
        vegetationShader = new VegetationShader();
        waterShader = new WaterShader();
    }

    public void update(float deltaTime) {
    }

    public void begin(Batch batch, ShaderType type) {
        switch (type) {
            case VEGETATION:
                vegetationShader.begin(batch);
                break;
            case WATER:
                waterShader.begin(batch);
                break;
            case NONE:
                batch.setShader(null);
                break;
        }
        currentShader = type;
    }

    public void end(Batch batch) {
        if (currentShader != ShaderType.NONE) {
            batch.setShader(null);
            currentShader = ShaderType.NONE;
        }
    }

    public VegetationShader getVegetationShader() {
        return vegetationShader;
    }

    public WaterShader getWaterShader() {
        return waterShader;
    }

    @Override
    public void dispose() {
        vegetationShader.dispose();
        waterShader.dispose();
    }
}
